#!/bin/bash
#src: https://ubuntuforums.org/showthread.php?t=1188099

#XXX: prerequisites: 
#execute:
# sudo groupadd no-internet
#put this line in /etc/sudoers(.d/20-no-internet)
# %wheel ALL=(:no-internet) NOPASSWD: ALL
# #src: https://askubuntu.com/questions/45072/how-to-control-internet-access-for-each-program
#put a+x file in /etc/NetworkManager/dispatcher.d/pre-up.d/iptables_no-internet_rule
#contents:
# iptables -C OUTPUT -m owner --gid-owner no-internet -j DROP || iptables -I OUTPUT -m owner --gid-owner no-internet -j DROP


#eof

#FIXM: allow aliases: ni fox  where fox is an alias
##ok, except... i'm passing the alias to sudo, so no effect:
#shopt -s expand_aliases
#shopt -s
##eg. ni fox

#sg no-internet "$@"
#src:ipu and https://askubuntu.com/questions/45072/how-to-control-internet-access-for-each-program
sudo -g no-internet -- "$@"

